package com.linln.admin.app.domain;

import com.linln.common.utils.StatusUtil;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * @author taofucheng
 * @date 2021/07/11
 */
@Data
@Entity
@Table(name = "app_version_app")
@EntityListeners(AuditingEntityListener.class)
@Where(clause = StatusUtil.NOT_DELETE)
@DynamicInsert
@DynamicUpdate
public class VersionApp implements Serializable {
    // 主键
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    // 项目主键
    private Long app_id;
    // 版本主键
    private Long version_id;
    // 是否有开发分支
    private String has_dev;
    // 是否有发布分支
    private String has_release;
    // 从prod合并状态
    private String merge_from_status;
    // 最后一次从prod合并代码时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date merge_from_time;
    // 合并到prod状态
    private String merge_to_status;
    // 合并到prod的时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date merge_to_time;
    // 上一次deploy打包结果
    private String deploy;
    // 创建时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date add_time;
    // 状态：1-正常；2-冻结；3-删除
    private Byte status = 1;
}